#include "fxcc/yml/Serializer.h"
#include "fxcc/core/graph/common/Shapes.h"

using namespace fxcc::yml;
using namespace fxcc::graph::common;

template<>
void Serializer::Encode<BoxShape>(YAML::Node& node, const BoxShape& inst)
{
    SetVariable<glm::vec3>(node, "m_HalfExtends", inst.m_HalfExtends);

}


template<>
bool Serializer::Decode<BoxShape>(const YAML::Node& node, BoxShape& inst)
{
    GetVariable<glm::vec3>(node, "m_HalfExtends", inst.m_HalfExtends);
    return true;
}

template<>
void Serializer::Encode<SphereShape>(YAML::Node& node, const SphereShape& inst)
{
    SetVariable<float>(node, "m_Radius", inst.m_Radius);

}


template<>
bool Serializer::Decode<SphereShape>(const YAML::Node& node, SphereShape& inst)
{
    GetVariable<float>(node, "m_Radius", inst.m_Radius);
    return true;
}


template<>
void Serializer::Encode<CapsuleShape>(YAML::Node& node, const CapsuleShape& inst)
{
    SetVariable<float>(node, "m_Radius", inst.m_Radius);
    SetVariable<float>(node, "m_Height", inst.m_Height);

}


template<>
bool Serializer::Decode<CapsuleShape>(const YAML::Node& node, CapsuleShape& inst)
{
    GetVariable<float>(node, "m_Radius", inst.m_Radius);
    GetVariable<float>(node, "m_Height", inst.m_Height);

    return true;
}


template<>
void Serializer::Encode<PlaneShape>(YAML::Node& node, const PlaneShape& inst)
{

}


template<>
bool Serializer::Decode<PlaneShape>(const YAML::Node& node, PlaneShape& inst)
{
    return true;
}
